Automation and versatile programmability of machinery, such as manufacturing machinery, is a crucial component in modern-day fabrication. Programmable logic controllers are often used to control the operation of the machinery, and may typically run an industrial control program that was written and compiled on an external programming environment. Their free programmability provides the flexibility to adapt the machinery in accordance with the given manufacturing task. However, in order to make efficient use of the machinery, it is desirable to carefully monitor the runtime of the computer program and its subroutines as they are executed on the programmable logic controller, preferably in real time and in the real industrial control environment.
Measurements of the runtime of a computer program are generally familiar from various fields of technology, and are sometimes known as profiling techniques. One skilled in the art is aware of two different kinds of profiling techniques:
In a statistical profiling, the program run is interrupted at specific pre-determined points in time, and the current call stack is determined. If repeated sufficiently often, this technique allows a statistical analysis of the runtime associated with specific functions of the program. Advantageously, statistical profiling may be employed without modifying the program code. However, these techniques do not allow a tailored and interactive profiling of specific functions.
An alternative profiling technique is code instrumentation. In this case, each function is provided with additional code so as to allow to measure the runtime of that function. The code instrumentation allows for a careful and tailored analysis of all the functions in the program. However, the additional code and profiling measurements need a large amount of memory space. Moreover, the additional code and time measurements slow down the execution of the program, which may be undesirable in an industrial control environment, or even impermissible due to safety constraints.
What is needed is a versatile and quick method and system for measuring a runtime in a compiled computer program, in particular for industrial control applications.